﻿namespace NEvoWeb.Modules.NB_Store
{
    using System;

    public class PlugIn
    {
        public static void InstallStorePlugin(int PortalID, string PluginName, string PluginCommand)
        {
            if (!PluginName.ToLower().EndsWith(".plugin"))
            {
                PluginName = PluginName + ".plugin";
            }
            if (SharedFunctions.GetStoreSetting(PortalID, PluginName, "None") == "")
            {
                SharedFunctions.SetStoreSetting(PortalID, PluginName, PluginCommand, "None", true);
            }
        }

        public static void InstallStorePlugin(int PortalID, string PluginName, string RootMenuId, string text, string image, string ctl, string ctlsrc, string param, string roles)
        {
            string pluginCommand = "";
            pluginCommand = "<root>";
            pluginCommand = (pluginCommand + "<tabs>") + "<tab id=\"" + RootMenuId + "\">";
            pluginCommand = ((pluginCommand + "<subtab text=\"" + text + "\" image=\"" + image + "\"  ctl=\"" + ctl + "\" ctlsrc=\"" + ctlsrc + "\" param=\"" + param + "\" roles=\"" + roles + "\"/>") + "</tab>") + "</tabs>" + "</root>";
            InstallStorePlugin(PortalID, PluginName, pluginCommand);
        }
    }
}

